package Model;

import java.util.ArrayList;

public class OwnerCollection {

    //Properties
    private ArrayList<Owner> ownerList;
    private static OwnerCollection instance;

    //Constructor
    public OwnerCollection(){
        ownerList = new ArrayList<Owner>();
    }

    //Singleton
    public static OwnerCollection getInstance(){
        if(instance == null){
            instance = new OwnerCollection();
        }

        return instance;
    }

    //Add an owner
    public void addOwner(Owner o){
        ownerList.add(o);
    }

    //Find owner
    public Owner findOwner(String ownerName){

        for (Owner o : ownerList){
            if(o.getOwnerName() == ownerName){
                return o;
            }
        }
        return null;
    }
}




